package main

import (
	"github.com/nntaoli-project/goex"
	"github.com/nntaoli-project/goex/binance"
	"log"
	"os"
	"time"
)

var futuresWs *binance.FuturesWs

func createFuturesWs()  {
	futuresWs = binance.NewFuturesWs()
	futuresWs.DepthCallback(func(depth *goex.Depth) {
		log.Println(depth)
	})
	futuresWs.TradeCallback(func(trade *goex.Trade, contract string) {
		log.Println(trade)
	})
}

func main() {
	os.Setenv("HTTPS_PROXY", "socks5://127.0.0.1:4781")
	os.Setenv("GOEX_LOG_LEVEL", "DEBUG")
	createFuturesWs()

	futuresWs.SubscribeTrade(goex.BTC_USDT, goex.SWAP_USDT_CONTRACT)
	time.Sleep(11 * time.Minute)
}